#!/bin/bash

function error_exit(){
	echo "ERROR:比较文件异常,"$1
	exit 1
}

configPath=$1
baseFile=$2
comFile=$3

cp ${baseFile} ${configPath}/validate_baseFile
cp ${comFile} ${configPath}/validata_comFile

cd ${configPath}

sed -i '/^\s*$/d' validate_baseFile validata_comFile || error_exit "sed异常1"
sed -i '/^\s*\/\//d' validate_baseFile validata_comFile || error_exit "sed异常2"
sed -i 's/=>[^\f\n\r\v]*//g' validate_baseFile validata_comFile || error_exit "sed异常3"
sed -i 's/=[^\f\n\r\v]*//g' validate_baseFile validata_comFile || error_exit "sed异常4"

diff -w --ignore-blank-lines validate_baseFile validata_comFile -y --suppress-common-lines || error_exit "diff异常"

rm -rf ${configPath}/validate_baseFile ${configPath}/validata_comFile
echo "SUCCESS"